<?php include("include/header.php");?>
        <section id="content">
          <section class="hbox stretch">
            <section>
              <section class="vbox">
                <section class="scrollable padder">
                    <div class="m-b-md">
                      <h3 class="m-b-none"></h3>
                    </div>
                    <ul class="breadcrumb">
                        <li><a href="index.php?c=main"><i class="fa fa-home"></i> 首页</a></li>
                        <li><a href="index.php?c=user"><i class="fa fa-list-ul"></i> 账号权限管理</a></li>
                        <li class="active">新增账号管理</li>
                    </ul>

                    <section class="panel panel-default">
                      <header class="panel-heading font-bold">新增账号</header>
                      <div class="panel-body">
						<iframe id="js_frame" name="js_frame" style="display:none;"></iframe>
                        <form class="form-horizontal" method="post" action="index.php?c=user&m=save" target="js_frame" >
                          <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-id-1">*姓名</label>
                            <div class="col-sm-10">
                              <input type="text" class="form-control" id="username" name="username">
                            </div>
                          </div>
                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-id-1">*账号</label>
                            <div class="col-sm-10">
                              <input type="text" class="form-control" id="account" name="account" onblur="check_value(this.value)">
                            </div>
                          </div>
                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">*密码</label>
                            <div class="col-sm-10">
                              <input type="password" id="password" name="password" class="form-control">
                            </div>
                          </div>
                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">*确认密码</label>
                            <div class="col-sm-10">
                              <input type="password" id="password1" name="password1" class="form-control">
                            </div>
                          </div>
                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-10">
                              <input type="text" class="form-control" id="remark" name="remark">
                            </div>
                          </div>
                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">*账号类型</label>
                            <div class="col-sm-10">
                                <label class="radio-inline">
                                  <input type="radio" name="user_type" id="user_type" value="1" checked="">
                                  普通管理员
                                </label>
                                <label class="radio-inline">
                                  <input type="radio" name="user_type" id="user_type" value="2">
                                  超级管理员
                                </label>
                            </div>
                          </div>

<!--                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">*管理公众号</label>
                            <div class="col-sm-10">
                              <div class="">
                                <div class="id-gl">
                                  <div class="id-l">
                                    <section class="vbox">
                                      <section class="scrollable">
                                        <ul id="id1">
			                               <?php foreach($tokendata as $row) {?>
		                                          <li ><?=$row['name']?><span style="display: none;">|<?php echo $row['id']; ?></span></li>
			                                <?php }?>
                                        </ul>
                                      </section>
                                    </section>
                                  </div>
                                  <div class="id-m">
                                    <button type="button" class="btn btn-default" id="btnGo">>></button>
                                    <button type="button" class="btn btn-default" id="btnBack"><<</button>
                                    <button type="button" class="btn btn-default" id="btnAll">全选</button>
                                    <button type="button" class="btn btn-default" id="btnNone">取消</button>
                                  </div>
                                  <div class="id-l">
                                    <section class="vbox">
                                      <section class="scrollable">
                                        <ul id="id2">
                                        </ul>
                                      </section>
                                    </section>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>-->

                          <div class="line line-dashed b-b line-lg pull-in"></div>
                          <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                              <button type="submit" class="btn btn-s-sm btn-success">提交</button>
                              <button type="submit" class="btn btn-s-sm btn-default">返回</button>
                            </div>
                          </div>
                        </form>
                      </div>
                    </section>



                </section>
              </section>
            </section>
          </section>
        </section>
<script type="text/javascript">
function idGl(){
  var nowWhi = 1;
  var zyHtml = "";
  var name;
  $("#id1").on("click", function(){
    nowWhi = 1;
    $("#btnBack").addClass("disabled").siblings().removeClass("disabled");
    $("#id2 li").removeClass("active");
  });
  $("#id2").on("click", function(){
    nowWhi = 2;
    $("#btnGo").addClass("disabled").siblings().removeClass("disabled");
    $("#id1 li").removeClass("active");
  });

  $("#id1 li").on("dblclick", function(){
    // zyHtml = '<li>' + $(this).html() + '</li>';
	name = $(this).text();
	var temp_arr = name.split('|');
	var SellPointName_temp = temp_arr[0];
	var SellPointID_temp = temp_arr[1];
	// alert(temp_arr);
	zyHtml = "<li><input type=\"text\" readonly value=\""+SellPointName_temp+"\"><input style=\"display: none;\" name=\"token[]\" type=\"text\" readonly value=\""+SellPointID_temp+"\"></li>";
    $(this).remove();
    $("#id2").append(zyHtml);
  });
  $("#id2 li").on("dblclick", function(){
    // zyHtml = '<li>' + $(this).html() + '</li>';
	var input_arr = $(this).find("input");
	var SellPointName_temp = input_arr.eq(0).val();
	var SellPointID_temp = input_arr.eq(1).val();
	zyHtml += "<li>"+SellPointName_temp+"<span style=\"display: none;\">|"+SellPointID_temp+"</span></li>";

    $(this).remove();
    $("#id1").append(zyHtml);
  });


  $(document).on("click", ".id-l li", function(){
    if($(this).hasClass("active")){
      $(this).removeClass("active")
    }else{
      $(this).addClass("active")
    }
  });

  $(document).on("dblclick", "#id1 li", function(){
	name = $(this).text();
	var temp_arr = name.split('|');
	var SellPointName_temp = temp_arr[0];
	var SellPointID_temp = temp_arr[1];
    // zyHtml = '<li>' + $(this).html() + '</li>';
	zyHtml = "<li><input type=\"text\" readonly value=\""+SellPointName_temp+"\"><input style=\"display: none;\" name=\"token[]\" type=\"text\" readonly value=\""+SellPointID_temp+"\"></li>";
    $(this).remove();
    $("#id2").append(zyHtml);
  });

  $(document).on("dblclick", "#id2 li", function(){
    // zyHtml = '<li>' + $(this).html() + '</li>';
	var input_arr = $(this).find("input");
	var SellPointName_temp = input_arr.eq(0).val();
	var SellPointID_temp = input_arr.eq(1).val();
	zyHtml = "<li>"+SellPointName_temp+"<span style=\"display: none;\">|"+SellPointID_temp+"</span></li>";

    $(this).remove();
    $("#id1").append(zyHtml);
  });


  $("#btnGo").on("click", function(){
    zyHtml = '';
    $("#id1 li.active").each(function(){
		name = $(this).text();
		var temp_arr = name.split('|');
		var SellPointName_temp = temp_arr[0];
		var SellPointID_temp = temp_arr[1];
		zyHtml += "<li><input type=\"text\" readonly value=\""+SellPointName_temp+"\"><input style=\"display: none;\" name=\"token[]\" type=\"text\" readonly value=\""+SellPointID_temp+"\"></li>";
         // zyHtml += '<li>' + $(this).html() + '</li>';
      $(this).remove();
    });
    $("#id2").append(zyHtml);
  });

  $("#btnBack").on("click", function(){
    zyHtml = '';
    $("#id2 li.active").each(function(){
		var input_arr = $(this).find("input");
		var SellPointName_temp = input_arr.eq(0).val();
		var SellPointID_temp = input_arr.eq(1).val();
		zyHtml += "<li>"+SellPointName_temp+"<span style=\"display: none;\">|"+SellPointID_temp+"</span></li>";

      // zyHtml += '<li>' + $(this).html() + '</li>';
      $(this).remove();
    });
    $("#id1").append(zyHtml);
  });


  $("#btnAll").on("click", function(){
    if(nowWhi == 1){
      $("#id1 li").addClass("active");
	  $("#id1 li.active").each(function(){
			name = $(this).text();
			var temp_arr = name.split('|');
			var SellPointName_temp = temp_arr[0];
			var SellPointID_temp = temp_arr[1];
			zyHtml += "<li><input type=\"text\" readonly value=\""+SellPointName_temp+"\"><input style=\"display: none;\" name=\"token[]\" type=\"text\" readonly value=\""+SellPointID_temp+"\"></li>";
	         $(this).remove();
	  });
	  $("#id2").append(zyHtml);
      $("#id2 li").removeClass("active");
    }else if(nowWhi == 2){
      $("#id2 li").addClass("active");
	    $("#id2 li.active").each(function(){
			var input_arr = $(this).find("input");
			var SellPointName_temp = input_arr.eq(0).val();
			var SellPointID_temp = input_arr.eq(1).val();
			zyHtml += "<li>"+SellPointName_temp+"<span style=\"display: none;\">|"+SellPointID_temp+"</span></li>";
	         $(this).remove();
	        // zyHtml += '<li>' + $(this).html() + '</li>';
	    });
	  $("#id1").append(zyHtml);
      $("#id1 li").removeClass("active");
    }
  });
  $("#btnNone").on("click", function(){
      $("#id1 li").removeClass("active");
      $("#id2 li").removeClass("active");
  });
}
idGl();
  function check_value(account_value)
  {
	$.post(
		"index.php?c=user&m=check_account",
		{
			account:account_value
		},
		function(data){
			if(data.status==1)
			{
				alert("此账号名已经存在！");
				$("#account").val("");
			}
		},"json"
	);
  }
</script>
<?php include("include/footer.php");?>